/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.diagram.component.command;

import org.eclipse.draw2d.geometry.Point;
import org.eclipse.uml2.uml.CollaborationUse;
import org.eclipse.uml2.uml.Element;

import com.cea.papyrus.diagram.component.helper.EdgeRoleBindingHelper;
import com.cea.papyrus.diagraminterchange2.di2.GraphEdge;
import com.cea.papyrus.diagraminterchange2.di2.GraphNode;
import com.cea.papyrus.diagraminterchange2.di2.Uml1SemanticModelBridge;

/**
 * 
 * 
 * @author CEA List
 */
public class DisplaybindingCommand extends RoleBindingCreateCommand{
	
	/**
	 * Instantiate a command that can create a connection between two Elements.
	 * 
	 * @param type of the link Dependency, azssociation...
	 * @param location 
	 * @param source the source endpoint
	 * @param point 	 */
	
	
	public DisplaybindingCommand(GraphNode source, Object type, Point location) {
		super(source, type, new Point(source.getPosition().x+source.getSize().width, source.getPosition().y));
		
	}

	/**
	 * 
	 * 
	 * @return 
	 */
	public Element createBussinessModel() {
			return cu; 
	}
	
	/**
	 * 
	 * 
	 * @return 
	 */
	public boolean canExecute(){
		return true;
	}
	
	/**
	 * 
	 * 
	 * @param collaborationUse 
	 */
	public void setCollaborationUse(CollaborationUse collaborationUse){
		cu=collaborationUse;
	}
	
	/**
	 * 
	 * 
	 * @param bridge 
	 * @param targetBridge 
	 * @param sourceBridge 
	 */
	public void reconnectBussinessModel(Uml1SemanticModelBridge bridge, Uml1SemanticModelBridge sourceBridge, Uml1SemanticModelBridge targetBridge) {
	}

	/**
	 * 
	 * 
	 * @param bridge 
	 * @param targetBridge 
	 * @param sourceBridge 
	 */
	public void disconnectBussinessModel(Uml1SemanticModelBridge bridge, Uml1SemanticModelBridge sourceBridge, Uml1SemanticModelBridge targetBridge) {
	}

	/* (non-Javadoc)
	 * @see com.cea.papyrus.common.connections.commands.ConnectionCreateCommandBase#createGraphEdge(org.eclipse.uml2.uml.Element)
	 */
	//@Override
	/**
	 * 
	 * 
	 * @param umlLink 
	 * 
	 * @return 
	 */
	protected GraphEdge createGraphEdge(Element umlLink) {
		EdgeRoleBindingHelper erbh= new EdgeRoleBindingHelper();
		return  (GraphEdge)erbh.createGraphElement(cu, getOwner(), null, null);
	}



}
